import { create } from '../asyncActionCreator';

/**
 * 获取数据
 * @type {String}
 */
export const GET_DATA_REQUEST = 'request source distribution chart data';
export const GET_DATA_SUCCESS = 'request source distribution chart data success';
export const GET_DATA_FAILURE = 'request source distribution chart data failure';

export const getDataRequest = () => ({
	type: GET_DATA_REQUEST,
	payload: {}
});

export const getDataSuccess = (data) => {
	console.log('success')
	return {
		type: GET_DATA_SUCCESS,
		payload: {
			data
		}
	}
};

export const getDataFailure = (message) => ({
	type: GET_DATA_FAILURE,
	payload: {
		message
	}
});

export const SOURCE_DISTRIBUTION_URL = '/api/data/ExaminationAnalysisSourceDistribution';

export const getSourceDistributionData = (params) => (
	create(SOURCE_DISTRIBUTION_URL,
		getDataRequest, 
		getDataSuccess, 
		getDataFailure, 
		params)
);
